import Mock from 'mockjs'
// import mock from 'mock';

const BASE_URL = ''

export default [{
		url: `${BASE_URL}/tree`,
		type: 'get',
		response: config => {
			const querys = config.query;
			let result = [];
			if (querys.type === 'org') {
				result = treeOrgNode
			} else if (querys.type === 'area') {
				result = treeAreaNode
			}
			return {
				code: 200,
				data: result,
			}
		}
	},
	{
		url: `${BASE_URL}/EnterpriseLst.asmx/getEntList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: "@guid",
					address: "@county", // 企业
					area: "@county", //所属区域
					enterpriseType: "@ctitle", // 企业类型
					enterprise: "@ctitle" // 地址
				}))
			}
			const enterpriseList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List

			return {
				code: 200,
				msg: '获取成功',
				data: {
					enterpriseList,
					total: count
				}
			}
		}
	},
	{
		url: `${BASE_URL}/EnterpriseLst.asmx/getArea`, // 获取所属区域
		type: 'post',
		response: config => {
			let result = [
				{
					label: "中国",
					value: "1",
					children: [
						{
							label: "江苏省",
							value: "2-1",
							children: [
								{
									label: "南京市",
									value: "3-1",
									
								},
								{
									label: "无锡市",
									value: "3-2"
								}
							]
						}
					]
				}
			]
			return {
				code: 200,
				msg: '获取成功',
				data: result
			}
		}
	},
	{
		url: `${BASE_URL}/SystemDictionary.asmx/getEnterpriseType`, // 获取企业类型
		type: 'post',
		response: config => {
			let result = [
				{
					label: "企业类型",
					value: "值"
				},
				{
					label: "企业类型1",
					value: "值1" // 企业类型名称对应的id或值
				},
			]
			return {
				code: 200,
				msg: '获取成功',
				data: result
			}
		}
	},
	{
		url: `${BASE_URL}/EnterpriseLst.asmx/belongEnv`, // 获取分管环保
		type: 'post',
		response: config => {
			let result = [
				{
					label: '某环保局',
					value: '该局id',
					children: [
						{
							label: '某环保局/分局',
							value: '该局id'
							// ...
						}
					]
				}, 
				{
					label: '某环保局',
					value: '该局id'
				}
			]
			return {
				code: 200,
				msg: '获取成功',
				data: result
			}
		}
	},
	{
		url: `${BASE_URL}/insertEntInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '添加成功'
			}
		}
	},
	{
		url: `${BASE_URL}/editEntInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{
		url: `${BASE_URL}/EnterpriseLst.asmx/getEntInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			let result = {
				"enterprise": "fd", // 企业名称
				"area": "fdf", // 所属区域
				"enterpriseType": "fe", // 企业类型
				"businessLicense": "fe", // 营业许可证
				"chargeEnv": "fs", // 分管环保
				"orgCode": "fe", // 组织机构代码
				"phone": "sf", // 电话
				"entNumber": "ef", // 企业编号
				"address": "fe", // 地址
				"entIntroduce": "r", // 企业介绍
				"lng": "fe", // 经度
				"lat": "fr", // 纬度
				imageUrl: "" // 图片
			}
			return {
				code: 200,
				msg: '获取成功',
				data: {data:result}
			}
		}
	},
	{
		url: `${BASE_URL}/getPermitInfo`, // 许可证信息
		type: 'post',
		response: config => {
			let query = config.query
			if (query.id) return
			let result = {
				enterpriseName: "", // 企业名称
				registerAddress: { // 注册地址
					districtPlan: "", // 注册地行政区域规划
					mail: "", // 邮政
					address: "", // 地址
					lng: "", // 经度
					lat: "", // 纬度
				},
				contactWay: {
					postAddress: "",// 通讯地址
					postCode: "",// 邮编
					contactPerson: "",// 联系人
					phone: ""// 手机
				},
				legalPerson: {
					name: "",// 姓名
					cellPhone: "",// 手机
					IDType: "",// 证件类型
					IDNumber: ""// 证件号码
				},
				sourceDepartment: [
					{
						index: 0,
						departmentName: "", // 部门名称
						leader: "",// 负责人
						address: "",// 地址
						workplace: ""// 工作场所
					}
				],
				typeScope:{
					producation: [],
					market: [],
					use: []
				},
				licenseInfo: {
					unitType: "",// 单位类型
					unitStatus: "", // 单位状态
					stdcallDep: "", // 发证机关
					credentialNo: "",// 证书编号
					issueDate: "", // 发证日期
					validDate: "", // 有效日期
					approvalDep: "",// 审批机关
					permitCard: "",// 许可证件
				}
			}
			return {
				code: 200,
				msg: '获取成功',
				data: result
			}
		}
	},
	// getTypeScope
	{
		url: `${BASE_URL}/EnterpriseLst.asmx/getTypeScope`, // 获取放射源种类和范围
		type: 'post',
		response: config => {
			let result = [
				{
					label: '生产', // 范围
					value: '范围id',
					classType: [
						{
							label: 'Ⅰ类', //类别
							value: '类别id'
						},
						{
							label: 'Ⅱ类', //类别
							value: '类别id'
						}
					]
				}, 
				{
					label: '销售', // 范围
					value: '范围id',
					classType: [
						{
							label: 'Ⅰ类', //类别
							value: '类别id'
						},
						{
							label: 'Ⅱ类', //类别
							value: '类别id'
						}
					]
				}
			]
			return {
				code: 200,
				msg: '获取成功',
				data: result
			}
		}
	},
	// ===================================================场所
	{
		url: `${BASE_URL}/EnterpriseSiteLst.asmx/getAreaList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				id
			} = config.query
			const count = 100;
			let List = [],
				cList = []

			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: "@guid",
					placeName: "@ctitle", // 场所名称
					area: "@county", //所属区域
					placeAddress: "@county", // 场所地址
					"latAndlng|1": ["132.412123,32.12331", "122.413331,23.111311", "126.415331,43.2311311"] // 经纬度
				}))
				cList.push(Mock.mock({
					id: "@guid",
					"licenseNumber|1": ["苏A13141", "苏B12141"], // 车牌号
					driver: "@cname", // 驾驶员
				}))
			}
			const areaList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List
			const carList = limit ? cList.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : cList

			return {
				code: 200,
				msg: '获取成功',
				data: {
					areaList,
					carList,
					total: count
				}
			}
		}
	},
    { //新增场所
		url: `${BASE_URL}/EnterpriseSiteLst.asmx/insertAreaInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '添加成功'
			}
		}
	},
	{//修改场所
		url: `${BASE_URL}/EnterpriseSiteLst.asmx/updateAreaInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{ //新增车辆数据
		url: `${BASE_URL}/EnterpriseSiteLst.asmx/insertCar`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '添加成功'
			}
		}
	},
	{//修改车辆数据
		url: `${BASE_URL}/EnterpriseSiteLst.asmx/updateCar`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{// 获取场所详情
		url: `${BASE_URL}/EnterpriseSiteLst.asmx/getAreaInfo`,
		type: 'post',
		response: config => {
			let query = config.query
			let result = null
            if(query.id) {
                result = Mock.mock({
                    id: "@guid",
                    placeType: "@cname",
                    placeName: "@cname",
                    placeRadius: "@cname",
                    area: "@cname",
                    lng: "132.412313",
                    lat: "31.532422",
					placeAddress: "@cname",
					"licenseNumber|1": ["苏A13141", "苏B12141"],
					driver:"@cname"
                })
            }
			return {
				code: 200,
                data:result,
				msg: '获取详情成功'
			}
		}
	},
	// ===================================================巡检仪
	{
		url: `${BASE_URL}/EnterprisePadLst.asmx/getPatrolList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				id
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: "@guid",
					MN: "@character", // MN号
					brand: "@ctitle" // 品牌

				}))
			}
			const patrolList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List

			return {
				code: 200,
				msg: '获取成功',
				data: {
					patrolList,
					total: count
				}
			}
		}
	},
    { //新增巡检仪
		url: `${BASE_URL}/EnterprisePadLst.asmx/insertPatro`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '添加成功'
			}
		}
	},
	{//修改巡检仪
		url: `${BASE_URL}/EnterprisePadLst.asmx/updatePatro`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
                data:result,
				msg: '修改成功'
			}
		}
	},
	{// 获取巡检仪详情
		url: `${BASE_URL}/EnterprisePadLst.asmx/getPatroInfo`,
		type: 'post',
		response: config => {
            let query = config.query
            if(query.id) {
                let result = Mock.mock({
                    id: "@guid",
                    MN: "@cname",
                    brand: "@cname"
                })
            }
			return {
				code: 200,
                data:result,
				msg: '获取详情成功'
			}
		}
	},
	// ===================================================数采仪
	{
		url: `${BASE_URL}/EnterpriseDataGatheringDeviceLst.asmx/getInstrumentList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				id
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: "@guid",
					installPlace: "@county", // 安装位置
					MN: "@character", // MN号
					factoryNo: "@character", // 出厂编号
					brand: "@ctitle" // 品牌
				}))
			}
			const instrumentList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List

			return {
				code: 200,
				msg: '获取成功',
				data: {
					instrumentList,
					total: count
				}
			}
		}
	},
    { //新增数采仪
		url: `${BASE_URL}/EnterpriseDataGatheringDeviceLst.asmx/insertInstrument`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '添加成功'
			}
		}
	},
	{//修改数采仪
		url: `${BASE_URL}/EnterpriseDataGatheringDeviceLst.asmx/updateInstrument`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{// 获取数采仪详情
		url: `${BASE_URL}/EnterpriseDataGatheringDeviceLst.asmx/getInstrumentInfo`,
		type: 'post',
		response: config => {
            let query = config.query
            let result = {}
			if (query.id) {
				result = Mock.mock({
                    id: "@guid",
                    installPlace: "XXXXX",
                    SCYinstallPlace: "",
                    MN: "XXXX",
                    deviceToken:"",
                    status: "",
					factoryNo: "XXX",
					brand: "XXX"
                })
            }
			return {
                code: 200,
                data:result,
				msg: '获取详情成功'
			}
		}
    },
	// ===================================================用源设备
	{
		url: `${BASE_URL}/EnterpriseSiteUseRadDeviceLst.asmx/getUseSourceDeviceList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				id
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: "@guid",
					instrument: "@county", // 数采仪
					"deviceType|1": ["类型1","类型2"], // 设备类型
					factoryNo: "@character", // 出厂编号
					brand: "@ctitle" // 品牌
				}))
			}
			const useSourceDeviceList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List

			return {
				code: 200,
				msg: '获取成功',
				data: {
					useSourceDeviceList,
					total: count
				}
			}
		}
	},
    { //新增用源设备
		url: `${BASE_URL}/EnterpriseSiteUseRadDeviceLst.asmx/insertUseSourceDevice`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '添加成功'
			}
		}
	},
	{//修改用源设备
		url: `${BASE_URL}/EnterpriseSiteUseRadDeviceLst.asmx/updateUseSourceDevice`,
		type: 'post',
		response: config => {
			let query = config.query
			return {
				code: 200,
				msg: '修改成功'
			}
		}
	},
	{// 获取用源设备详情
		url: `${BASE_URL}/EnterpriseSiteUseRadDeviceLst.asmx/getUseSourceDeviceInfo`,
		type: 'post',
		response: config => {
            let query = config.query
            if(query.id) {
                let result = Mock.mock({
                    id: "",
                    instrument: "XXXXX",
                    useSourceDevice: "X",
					deviceType: "XXXX",
                    factoryNo: "XXX",
                    RFID: "X",
                    installPlace: "X",
                    status: "XX",
					brand: "XXX"
                })
            }
			return {
				code: 200,
                data:result,
				msg: '获取详情成功'
			}
		}
    },
	{
		url: `${BASE_URL}/UseRadDeviceMonitorObjectLst.asmx/getDeviceMonitorList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				id
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: "@guid",
					useSourceDevice: "@county", // 用源设备
					monitorFactor: "@character", // 监控因子
					alias: "@character", // 别名
					unitCoefficient: "@ctitle" // 单位系数
				}))
			}
			const deviceMonitorList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List

			return {
				code: 200,
				msg: '获取成功',
				data: {
					deviceMonitorList,
					total: count
				}
			}
		}
	},
	{
		url: `${BASE_URL}/getSourceList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				id
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: "@guid",
					placeName: "@county", // 场所名称
					nuclideName: "@character", // 核素名
					sourceCode: "@character", // 源国家编码
					sourceUse: "@ctitle" // 源用途
				}))
			}
			const sourceList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List

			return {
				code: 200,
				msg: '获取成功',
				data: {
					sourceList,
					total: count
				}
			}
		}
	},
	 // 获取源信息详情
	 {
		url: `${BASE_URL}/EnterpriseSiteRadLst.asmx/getRadInfo`,
		type: 'post',
		response: config => {
            const querys = config.query;
            const id = query.id;
			const result = {
                id: 23, // 源id
                factoryActivity :"出厂活度", // 出厂活度
                factoryTime:"fd",	//出厂日期
                grade:"er",//标号
                hairWeight:67,//毛重
                halfTime:"23",//半衰期
                isRiskSource:true,//是否为风险源
                jobInterval:12,//作业巡检间隔（小时）
                nuclideName:"wf",//核素名称
                place:"fd",//场所
                receiptDate:"tr",//接收日期
                sourceCode:"dgfd",//源国家编码
                sourceType:"th",//源类别
                sourceUnit:"ku",//产源单位
                sourceUse:"ju",//源用途
                stockpileStatus:"rt",//收储状态
                strength:"yt",//强度
                sourceImage:"utu",//源图片
                useSourceDevice:"yt",//用源设备
                weight:34//净重
            }
			return {
				code: 200,
				data: result,
			}
		}
    },
    // 新增源信息
    {
		url: `${BASE_URL}/EnterpriseSiteRadLst.asmx/insertRad`,
		type: 'post',
		response: config => {
			const querys = config.query;
			return {
                code: 200,
                msg: '新增成功',
			}
		}
    },
    // 修改源信息
    {
		url: `${BASE_URL}/EnterpriseSiteRadLst.asmx/updateRad`,
		type: 'post',
		response: config => {
			const querys = config.query;
			return {
                code: 200,
                msg: '编辑成功',
			}
		}
    },
	{
		url: `${BASE_URL}/getVideoList`,
		type: 'post',
		response: config => {
			const {
				page,
				limit,
				id
			} = config.query
			const count = 100;
			let List = []
			for (let i = 0; i < count; i++) {
				List.push(Mock.mock({
					id: "@guid",
					"port|1": ["8080","8090"], // 端口
					"IP|1": ["127.1.1.0","151.2.12.33"], // IP
					wayNum: "@character", // 路数
					name: "@ctitle" // 名称
				}))
			}
			const videoList = limit ? List.filter((item, index) => index < limit * page && index >= limit * (page - 1)) : List

			return {
				code: 200,
				msg: '获取成功',
				data: {
					videoList,
					total: count
				}
			}
		}
	},
	//获取设备监控因子详情
    {
		url: `${BASE_URL}/UseRadDeviceMonitorObjectLst.asmx/getDeviceMonitorInfo`,
		type: 'post',
		response: config => {
            const querys = config.query;
            const id = query.id;
			const result = {
                id: 10, // 监控因子信息id
                deviceFactor: 1, // 监控设备
                monitorFactor: 1, // 监控因子
                alias: "dgds",// 别名
                unitCoefficient: "23",// 单位系数
            }
			return {
				code: 200,
				data: result,
			}
		}
    },
    // 新增源信息
    {
		url: `${BASE_URL}/UseRadDeviceMonitorObjectLst.asmx/insertDeviceMonitor`,
		type: 'post',
		response: config => {
			const querys = config.query;
			return {
                code: 200,
                msg: '新增成功',
			}
		}
    },
    // 修改源信息
    {
		url: `${BASE_URL}/UseRadDeviceMonitorObjectLst.asmx/updateDeviceMonitor`,
		type: 'post',
		response: config => {
			const querys = config.query;
			return {
                code: 200,
                msg: '编辑成功',
			}
		}
    },

]
